package py.com.sole.converter;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import py.com.sole.dao.DaoFactory;
import py.com.sole.model.Alumno;
import py.com.sole.model.Ciudad;

@FacesConverter(value="alumnoConverter")
public class AlumnoConverter implements Converter {

	@Override
	public Object getAsObject(FacesContext context, UIComponent component,
			String value) {
		
		if(value==null||value.equals("")){
            return null;
        }
		
		Alumno alumno = new Alumno();
		alumno = DaoFactory.getAlumno().getAlumnoByName(value);
		return alumno;
	}

	@Override
	public String getAsString(FacesContext context, UIComponent component,
			Object value) {
		if(value==null){
            return null;
        }
		Alumno alumno = (Alumno)value;
		//return alumno.getDescripcion().toString();
		return null;
	}

}
